﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using He.Common;
using He.Web.UI;

namespace He.Web.manage
{
    public partial class admin_sys : He.Web.UI.Manage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack)
            {
                if (Session["AdminName"] != null && Session["AdminType"] != null)
                {
                    string AdminName = Session["AdminName"].ToString();
                    int AdminType = int.Parse(Session["AdminType"].ToString());
                    lblAdminName.Text = string.Format("{0} ({1}) ", AdminName, GetAdminType(AdminType));
                    if (AdminType > (int)Enums.AdminType.开发人员)
                    {
                        Response.Write("<script>alert('您没有足够的权限进入该区域！');window.location.href='" + SysKeys.ADMIN_LOGIN_PAGE + "'</script>");
                    }
                }
                else
                {
                    Response.Redirect(SysKeys.ADMIN_LOGIN_PAGE);
                }
            }
        }

        protected void lbtnExit_Click(object sender, EventArgs e)
        {
            Session["AdminNo"] = null;
            Session["AdminName"] = null;
            Session["AdminType"] = null;
            Session["AdminLevel"] = null;
            CookieHelper.Remove("AdminName");
            CookieHelper.Remove("AdminPwd");
            Response.Redirect(webset.web_path + SysKeys.ADMIN_LOGIN_PAGE);
        }

        protected void lbtnClearCache_Click(object sender, EventArgs e)
        {
            RemoveAllCache();
            Response.Write("<script type=\"text/javascript\">alert('清理缓存成功啦');window.location.href='admin_sys.aspx?lang=" + lang + "'</script>");
        }


    }
}